package com.atguigu.tingshu.order.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.service.OrderInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Haoran Sun
 * @since 2024/08/28
 */

@RestController
@RequestMapping("client/order/orderInfo")
public class OrderInfoClientController {
    @Resource
    private OrderInfoService orderInfoService;

    /**
     * 根据订单号查询订单信息
     * @param orderNo 订单号
     * @return 订单信息
     */
    @GetMapping(value = "/getOrderInfo/{orderNo}")
    Result<OrderInfo> getOrderInfo(@PathVariable("orderNo") String orderNo){
        return Result.ok(orderInfoService.getOne(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderNo, orderNo)));
    }


}
